package yja.gzw.app.activity

import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import yja.gzw.app.R
import yja.gzw.app.adapter.HuifuPinglongAdapter
import yja.gzw.app.adapter.PinglongAdapter
import yja.gzw.app.base.BaseActivity
import yja.gzw.app.databinding.ActivityPinglongzhanshiBinding
import yja.gzw.app.model.UserData
import yja.gzw.app.model.bean.Commenthuifu
import yja.gzw.app.model.bean.Commentpl
import yja.gzw.app.viewmodel.Mainviewmodel

class PinglongzhanshiActivity :BaseActivity<Mainviewmodel, ActivityPinglongzhanshiBinding>(R.layout.activity_pinglongzhanshi),HuifuPinglongAdapter.OnItemClickListener{
    private lateinit var fabiada: HuifuPinglongAdapter

    override fun initView() {

        viewmodel.onhuifuwang(UserData.token,mapOf("pid" to ""))
    }

    override fun dataObservese() {
        viewmodel.onhuifu.observe(this, Observer {
            if(it.code==1){
                binding.review.layoutManager=
                    LinearLayoutManager(this)
                fabiada= HuifuPinglongAdapter(this,it.data.data,this)
                binding.review.adapter= fabiada


            }else{
                Toast.makeText(this,it.msg, Toast.LENGTH_SHORT).show()

            }


        })
    }

    override fun onItemClick(position: Int, uri: Commenthuifu) {

    }

}